package edu.ncst.baseweb.controller.webmanage;

import cn.wintersun.basecommon.common.Result;
import edu.ncst.baseweb.dao.web.LabRules;
import edu.ncst.baseweb.service.intrer.webmanage.LabRulesManageService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/lab/information/rules")
@PreAuthorize("hasAuthority('6')")
public class LabRulesManageController {

    @Autowired
    private LabRulesManageService LabRulesManageService;

    @RequestMapping(value = "list",method = RequestMethod.POST)
    public Result<IPage<LabRules>> list(@RequestBody LabRules LabRules){

        return  LabRulesManageService.list(LabRules);
    }

    @RequestMapping(value = "save",method = RequestMethod.POST)
    public Result<Object> save(@RequestBody LabRules LabRules){

        return  LabRulesManageService.save(LabRules);
    }

    @RequestMapping(value = "delete",method = RequestMethod.POST)
    public Result<Object> delete(@RequestBody String LabRulesId){
        try {
            return LabRulesManageService.delete(LabRulesId);
        } catch (Exception e) {
            return Result.failure(500, e.getMessage());
        }
    }

}
